﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EZCRS.HCMS.Entity;
using EZCRS.HCMS.Data;

namespace EZCRS.HCMS.SqlClient
{
    /// <summary>
    /// 地区信息 省份管理
    /// </summary>
    public class sql_hcrs_province
    {
        string sqlstr = "";
        /// <summary>
        /// 获得所有省份列表
        /// </summary>
        /// <returns></returns>
        public List<HCRS_Province> getallprovince(string keys,int languagetype)
        {
            if (keys == "")
                sqlstr = "select * from HCRS_Province";
            else
                sqlstr = "select * from HCRS_Province";
            return ExecSql.GetTableList<HCRS_Province>(sqlstr);
        }

        /// <summary>
        /// 获得单条
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HCRS_Province getitem(int id)
        {
            return new HCRS_Province(ExecSql.GetDataSet("select * from HCRS_Province where ProvinceID=" + id.ToString() + " ").Tables[0].Rows[0]);
        }

        /// <summary>
        /// 删除单条
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool delprovince(int id)
        {
            if (ExecSql.SqlExecNoquery("delete from HCRS_Province where ProvinceID=" + id.ToString() + "") > 0)
                return true;
            else
                return false;
        }

        /// <summary>
        /// 新增或更新
        /// </summary>
        /// <param name="_province"></param>
        /// <returns></returns>
        public bool insertorupdate(HCRS_Province _province)
        {
            return ExecSql.InsertOrUpdateData<HCRS_Province>(_province);
        }
    }
}
